﻿using Bogus;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FreeSql.DataAnnotations;

namespace DataGridView.Models
{
    [Table(Name ="Employees")]
    public class Employee
    {
        [Column(IsPrimary = true)]
        public int Id { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public DateOnly Birthday { get; set; }
        public int Salary { get; set; }
        public static Employee FakeOne() => employeeFaker.Generate();
        public static IEnumerable<Employee> FakeMany(int count) =>employeeFaker.Generate(count);

        private static readonly Faker<Employee> employeeFaker = new Faker<Employee>()
            .RuleFor(e => e.Id, f => f.IndexFaker)
            .RuleFor(e => e.FirstName, f => f.Person.FirstName)
            .RuleFor(e => e.LastName, f => f.Person.LastName)
            .RuleFor(e => e.Birthday, f => DateOnly.FromDateTime(f.Person.DateOfBirth))
            .RuleFor(e => e.Salary, f => f.Random.Int(min: 3000, max: 30000));
    }

}
